﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;


namespace My.Utils
{
    public class FileOp
    {
        /// <summary>
        /// 写入磁盘文件
        /// </summary>
        /// <param name="path"></param>
        /// <param name="content"></param>
        /// <returns></returns>
        public static bool WriteFile(string path, string content)
        {

            StreamWriter sw = new StreamWriter(path, true, System.Text.Encoding.Default);
            try
            {
                sw.Write(content);
                sw.Flush();
            }
            finally
            {
                sw.Close();
            }


            return true;


        }

        public static string ReadFile(string path) {
            StreamReader sr = new StreamReader(path);
            string result = string.Empty;
            try
            {
                result=sr.ReadToEnd();
            }
            finally {
                sr.Close();
            }
            return result;
        }

    }
}
